package com.netease.nie.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.netease.nie.base.utils.DateUtils;
import com.netease.nie.common.CommonService;
import com.netease.nie.dao.ExchangeGoodsInfoDao;
import com.netease.nie.dto.ExchangeGoodsInfoListDto;
import com.netease.nie.model.ExchangeGoodsInfo;

/**
 * 
 * @author wwbn3695
 * @createDate June 24th,2016
 *
 */
@Service
public class ColumnInfoGoodsServiceImpl extends CommonService implements ColumnInfoGoodsService {

	@Autowired
	private ExchangeGoodsInfoDao exchangeGoodsInfoDao;
	
	public List<ExchangeGoodsInfoListDto> queryGoodsInfoListByColumnInfoId(
			int columnId, int pageIndex, int pageSize) {
		long currTimeMills = DateUtils.currentTimeInMills();
		List<ExchangeGoodsInfo> exchangeGoodsInfoList = exchangeGoodsInfoDao.queryGoodsInfoListByColumnInfoId(columnId, pageIndex, pageSize);
		List<ExchangeGoodsInfoListDto> exchangeGoodsInfoListDtoList = generateGoodsInfoDtoList(exchangeGoodsInfoList, currTimeMills);
		return exchangeGoodsInfoListDtoList;
	}

	public List<ExchangeGoodsInfoListDto> queryGoodsInfoListByColumnInfoIds(List<Integer> columnInfoIds) {
		long currTimeMills = DateUtils.currentTimeInMills();
		List<ExchangeGoodsInfo> exchangeGoodsInfoList = exchangeGoodsInfoDao.queryGoodsInfoListByColumnInfoIds(columnInfoIds);
		List<ExchangeGoodsInfoListDto> goodsInfoListDtoList = generateGoodsInfoDtoList(exchangeGoodsInfoList, currTimeMills);
		return goodsInfoListDtoList;
	}
	
}
